package me.luger.project.base;

import me.luger.core.mvc.controller.BaseController;
import me.luger.project.base.modules.sys.service.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * HomeControlelr
 *
 * @author luger
 * @date 2016/12/6 0006
 */
@Controller
@RequestMapping("/private")
public class HomeControlelr extends BaseController {
    @Autowired
    private AdminUserService adminUserService;

    @RequestMapping(value = "/loginPage",name = "登陆页面")
    public String loginPage(){
        return "admin/login";
    }

//    @RequestMapping(value = "/doLogin",name = "登陆操作",method = RequestMethod.POST)
//    @ResponseBody
//    public Object doLogin(String userName,String password){
//        SysAdminUser adminUser = adminUserService.login(userName,password);
//        if(null != adminUser){
//            request.getSession().setAttribute("adminUser",adminUser);
//            return Result.success();
//        }else{
//            return Result.error();
//        }
//    }

    @RequestMapping(value = "/loginOut",name = "退出登录接口")
    public String loginOut(){
        request.getSession().removeAttribute("adminUser");
        return "redirect:/private/loginPage";
    }

    @RequestMapping(value = "/home",name = "登陆后的首页")
    public String home(){
        return "admin/home";
    }
}
